package com.bao.interkont.server.impl;

import com.bao.interkont.mapper.UserMapper;
import com.bao.interkont.pojo.Result;
import com.bao.interkont.pojo.User;
import com.bao.interkont.server.UserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author bao*
 * @version 1.0
 */
@Service
public class UserServerImpl implements UserServer {
    @Autowired
    private UserMapper userMapper;

    public List<User> getUser() {
        List<User> users = userMapper.getUser();
        users.forEach(user -> {
            user.setPassword(null);
            user.setAccount(null);
        });
        return users;
    }

    @Override
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    @Override
    public User isAccountSame(String account) {
        User users = userMapper.isAccountSame(account);
        return users;
    }

    @Override
    public User getUserByUid(Integer uid) {
        return userMapper.getUserByUid(uid);
    }

}
